import React, {useEffect} from 'react';
import { useLocation } from 'react-router-dom';
import styled from 'styled-components'

const Container = styled.div`
 & {
  ::-webkit-scrollbar { 
      display: none;
    }
 }
`

const getWindowHeight = () => {
  const ifm = document.getElementById('iframe')
  ifm.height = document.documentElement.clientHeight
}

const FrameDetail = (prop) => {
  useEffect(() => {
    return () => {
    };
  }, []);
  const location = useLocation()
  const state = location.state
  console.log('state: ', state);
  return (
    <Container>
      <iframe id='iframe' frameBorder="0" border="0" style={{overflow: "hidden"}} scrolling="no" onLoad={() => getWindowHeight()} width="100%" height="500" scrolling="auto" src={state && state.datas.post_url}></iframe>
    </Container>
  );
}

export default FrameDetail;
